<template>
  <div class="fenlei">
   <van-nav-bar
  title="分类"
  left-text="返回"
  right-text="首页"
  left-arrow
  @click-left="onClickLeft"
  @click-right="onClickRight"
/>
<div class="classification">
<van-tree-select
  v-for="item in categories"

  :items="item.name"
  :active-id.sync="activeId"
  :main-active-index.sync="activeIndex"
/>
</div>
  </div>
</template>
  
<script>
import { getproducts,getcategories } from "../../api/product";
export default {
  data() {
    return {
      categories:{},
      items,
      activeId: 1,
      activeIndex: 0,
    };
  },
  computed: {},
  watch: {},

  methods: {
    async shoptype(){
      const result = await getcategories();
      console.log(result);
      this.categories=result.categories;
    },
    onClickLeft() {
      this.$router.go(-1);
    },
    onClickRight() {
      this.$router.push("/home");
    },
  },
  created() {
    this.shoptype()
  },
  mounted() {},
  components: {},

};
</script>
<style scoped>
.fenlei {
  display: flex;
  flex-direction: column;
}</style>
